package com.mikelouis.test.scala.proginscala.chapter14

import org.specs2.mutable.Specification

/**
 * Created by yuazhu on 1/18/2015.
 */
object Element2Spec2SpecTestSuite extends Specification {
  "A UniformElement" should {
    "have a width equal to the passed value" in {
      val ele = Element2.elem('x', 2, 3)
      ele.width must be_==(2)
    }

    "have a height equal to the passed value" in {
      val ele = Element2.elem('x', 2, 3)
      ele.height must be_==(3)
    }

    "throw an IAE if passed a negative width" in {
      negativeWidth must throwA[IllegalArgumentException]
    }
  }

  def negativeWidth: String = {
    Element2.elem('x', -2, 3)
    throw new IllegalArgumentException("manually throw IllegalArgumentException")
  }
}
